package com.yang.SpingBoot.dao;


import com.yang.SpingBoot.model.WeiBo;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface WeiBoMapper {

    @Insert("INSERT INTO weibo(content,zf,dz,sc,pl,wdate) VALUES(#{content}, #{zhuanfa}, #{dianzan},#{shoucang},#{pinglun},#{wdate})")
    void save(WeiBo weiBo);

    @Select("select * from weibo order by id limit #{page},20")
    @Results({
            @Result(id = true,column = "id",property = "id"),
            @Result(column = "content",property = "content"),
            @Result(column = "zf",property = "zhuanfa"),
            @Result(column = "dz",property = "dianzan"),
            @Result(column = "sc",property = "shoucang"),
            @Result(column = "pl",property = "pinglun"),
            @Result(column = "wdate",property = "wdate"),
    })
    List<WeiBo> select(@Param("page") int page);

    @Update("update weibo set wsort=#{sort} where id = #{id}")
    void updateSort(@Param("id") String id,@Param("sort") String sort);
}
